package cn.tedu.drawn.admin.cotroller;

import cn.tedu.drawn.admin.pojo.entity.Banner;
import cn.tedu.drawn.admin.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/banner")
public class BannerController {


    @Autowired(required = false)
    BannerService bannerService;

    @RequestMapping("/select")
    public List<Banner> select(){
        return bannerService.select();
    }
    @RequestMapping("/delete")
    public void delete(int id){
        bannerService.delete(id);
    }

    @RequestMapping("/insert")
    public void insert(String url){
        bannerService.insert(url);
    }
    @RequestMapping("/selectById")
    public String selectById(int id){
        return bannerService.selectById(id);
    }
    @RequestMapping("/update")
    public void update(@RequestBody Banner banner){
        bannerService.update(banner);
    }

}
